// custom-tab-bar/index.ts
Component({
    /**
     * 组件的属性列表
     */
    properties: {
    },

    /**
     * 组件的初始数据
     */
    data: {
        selected: 0,
        color: "#cdcdcd",
        selectedColor: "#2d69ff",
        list: [
            {
                "selectedIconPath": "../images/icons/home.png",
                "iconPath": "../images/icons/home-1.png",
                "pagePath": "/pages/index/index",
                "text": "首页"
            },
            {
                "selectedIconPath": "../images/icons/editor.png",
                "iconPath": "../images/icons/editor-1.png",
                "pagePath": "/pages/appointment/index",
                "text": "预约"
            },
            {
                "selectedIconPath": "../images/icons/like.png",
                "iconPath": "../images/icons/like-1.png",
                "pagePath": "/pages/about/about",
                "text": "关于我们"
            },
            {
                "selectedIconPath": "../images/icons/call.png",
                "iconPath": "../images/icons/call-1.png",
                "pagePath": "/pages/contact/contact",
                "text": "联系我们"
            }
        ]
    },

    /**
     * 组件的方法列表
     */
    methods: {
        switchTab(e: any) {
            const data = e.currentTarget.dataset
            const url = data.path
            this.setData({
                selected: data.index
            })
            wx.switchTab({ url, fail(res) { debugger } })
            // debugger
        }
    }
})
